#ifndef PARTICLE_SHADER_PROGRAM_H
#define PARTICLE_SHADER_PROGRAM_H

#include <QOpenGLFunctions>
#include <QOpenGLShader>
#include <QOpenGLShaderProgram>
#include "shader_program.h"

class ParticleShaderProgram : public ShaderProgram {
    public:
        explicit ParticleShaderProgram(const char* vetexShaderSrc, const char* fragmentShaderSrc):
            ShaderProgram(vetexShaderSrc, fragmentShaderSrc) {
                m_uCurrentTime = m_program->uniformLocation("u_CurrentTime");
                m_uTextureUnit = m_program->uniformLocation("u_TextureUnit");
                m_aColor= m_program->attributeLocation("a_Color");
                m_aDirection = m_program->attributeLocation("a_Direction");
                m_aStartTime = m_program->attributeLocation("a_StartTime");
            };
        ~ParticleShaderProgram() = default;

    public:
        int uniformCurrentTime() const;
        int attrColor() const;
        int attrDirection() const;
        int attrStartTime() const;
        int uniformTextureUnit() const;

    private:
        int m_uCurrentTime = -1;
        int m_uTextureUnit = -1;
        int m_aColor = -1;
        int m_aDirection = -1;
        int m_aStartTime = -1;
};

inline int ParticleShaderProgram::uniformCurrentTime() const {
    return m_uCurrentTime;
}

inline int ParticleShaderProgram::uniformTextureUnit() const
{
    return m_uTextureUnit;
}

inline int ParticleShaderProgram::attrColor() const {
    return m_aColor;
}

inline int ParticleShaderProgram::attrDirection() const {
    return m_aDirection;
}

inline int ParticleShaderProgram::attrStartTime() const {
    return m_aStartTime;
}
#endif // PARTICLE_SHADER_PROGRAM_H
